Write operations to and from multiple buffers

ABSTRACT

Computer readable media, methods and apparatuses are disclosed that may be configured for sequentially reading data of a file stored on a storage medium. The disclosure also provides for alternating writing, in a sequential order, portions of the file data to a first buffer and a second buffer. The disclosure also provides for writing from a first buffer and a second buffer to a first track until the first track is filled.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No.13/360,064, filed on Jan. 27, 2012 (now U.S. Pat. No. 8,639,894), thedisclosure of which is hereby incorporated in its entirety.

BACKGROUND

A communication channel between computers sending and receiving data maybe a bottleneck for data transfer. One mechanism for transferring a datafile from one computer to another uses multiple concurrent threads thatsimultaneously process different blocks of data from the file inparallel. The processed data blocks may then be sent via thecommunication channel.

Parallel processing, however, may cause problems, such as due to datablocks of a file being received out of order. Receiving computingdevices may write the received data blocks to a storage medium in theorder of receipt, which may result in the data blocks of the file beingfragmented (e.g., not located sequentially) on the storage medium. Toread the fragmented file, a read head may have to move from location tolocation on the storage medium. For example, during a seek operation,the read head may be searching for a start of the next block on thestorage medium, while not reading the block data during the move.Movement of the read head from location to location on the storagemedium adds to the amount of time required retrieve the file.

A further drawback of conventional systems relates to an end of filemarker of the file. The end of file marker may indicate that aparticular data block is a last piece of data for a file. Due to datablocks being sent concurrently, the receiving computer may receive thedata block containing the end of file marker before all other datablocks of a file have been received. The receiving computer may writethe data block containing the end of file marker to the storage medium,and thereafter may receive data blocks of the file that are to bewritten to the storage medium after receipt of the end of file marker.Writing after an end of file marker may be very complex and may have tobe handled separately for different platforms, such as, for example,MAC™, WINDOWS™, and LINUX™. Improved methods and systems are needed.

SUMMARY

The following presents a simplified summary in order to provide a basicunderstanding of some aspects as described herein. The summary is not anextensive overview of all aspects. It is neither intended to identifykey or critical elements nor to delineate the scope of the presentdisclosure. The following summary merely presents various exampleconcepts in a simplified form as a prelude to the more detaileddescription below.

A new method, apparatus, computer readable medium, and system forreading/writing data from/to storage devices using parallel processingthreads is described herein.

According to some aspects, computer readable media, methods,apparatuses, and systems are disclosed that may be configured forsequentially reading data of a file stored on a storage medium. Thedisclosure may also provide for alternating transferring of fixed sizeportions of the file data to a first buffer and a second buffer. In someaspects, the example embodiments may be configured for alternatingprocessing of data blocks of the fixed sized portions in parallel fromthe first and second buffers by a plurality of processing threads, andoutputting the processed data blocks.

According to some aspects, example embodiments may be configured forreceiving data of a file and assigning portions of the data to each of aplurality of processing threads for processing of the assigned portionsby the respective threads in parallel, each of the threads beingimplemented by at least one processor. In some aspects, the exampleembodiments may be configured for writing, by the threads in parallel,blocks of the data to a first buffer and blocks of the data to a secondbuffer, and alternating transferring of the data blocks in the firstbuffer and the data blocks in the second buffer to a storage device. Insome aspects, the example embodiments may be configured for sequentiallywriting, by the storage device, each of the data blocks from the firstbuffer adjacent to one another on a storage medium.

These and other aspects of the disclosure will be apparent uponconsideration of the following detailed description.

BRIEF DESCRIPTION OF THE DRAWINGS

A more complete understanding of the present disclosure and thepotential advantages of various aspects described herein may be acquiredby referring to the following description in consideration of theaccompanying drawings, in which like reference numbers indicate likefeatures, and wherein:

FIG. 1 illustrates a functional component diagram in accordance withexample embodiments of the disclosure.

FIG. 2 illustrates a functional component diagram of an illustrativecomputing device in accordance with example embodiments of thedisclosure.

FIG. 3 illustrates a storage device in accordance with exampleembodiments of the disclosure.

FIG. 4 illustrates a multi-buffer arrangement in accordance with exampleembodiments of the disclosure.

FIG. 5 illustrates an example diagram of multiple threads concurrentlyprocessing blocks of file data in accordance with example embodiments ofthe disclosure.

FIG. 6 illustrates an example multi-buffer arrangement for parallelthread processing of data in accordance with example embodiments of thedisclosure.

FIG. 7 illustrates a flow diagram of an example method for reading filedata in accordance with example embodiments of the disclosure.

FIG. 8 illustrates a flow diagram of an example method for writingblocks of file data to a storage device in accordance with exampleembodiments of the disclosure.

DETAILED DESCRIPTION

In the following description of the various embodiments, reference ismade to the accompanying drawings, which form a part hereof, and inwhich is shown by way of illustration various embodiments in which thedisclosure may be practiced. It is to be understood that otherembodiments may be utilized and structural and functional modificationsmay be made without departing from the scope and spirit of the presentdisclosure.

FIG. 1 illustrates a functional component diagram of an illustrativesystem in accordance with example embodiments of the disclosure. In oneaspect, the system may be adapted for performing efficient read andwrite operations by a storage device using parallel threads. In oneexample, the system 100 may include a network 106 coupled to a sendingcomputing device 102 (e.g., computer) and a receiving computing device104 (e.g., computer). Network 106 may be any type of network, and may bea single network or a combination of multiple networks, such as, forexample, a cable and/or fiber optic and/or satellite contentdistribution network, a hybrid fiber-coaxial (HFC) network, a telephonenetwork, a wireless network and/or may be a local network or a publicnetwork such as the Internet. Example networks may include a wide areanetwork, a local area network, a wireless network, and/or combinationsthereof. Physically, network 106 may be embodied, for example, asmultiple computers communicatively coupled together as a plurality ofnodes in a wired and/or wireless manner. Network 106 may also beconfigured to transport data using a communication protocol, such as,for example, transmission control protocol/Internet protocol (TCP/IP),user datagram protocol (UDP), or other manners for transporting data viaa network.

Any of the above-mentioned functional components, including sendingcomputing device 102 and receiving computing device 104, may each beimplemented, for example, as a computer or as a system or device thatincludes a computer. The term “computer” as referred to herein broadlyrefers to any electronic, electro-optical, and/or mechanical device, orsystem of multiple physically separate or physically joined suchdevices, that is able to process and manipulate information, such as inthe form of data. Non-limiting examples of a computer include one ormore personal computers (e.g., desktop or laptop), servers, smartphones, personal digital assistants (PDAs), television set top boxes,and/or a system of these in any combination or subcombination. Inaddition, a given computer may be physically located completely in onelocation or may be distributed amongst a plurality of locations (e.g.,may implement distributive computing). A computer may be or include ageneral-purpose computer and/or a dedicated computer configured toperform only certain limited functions.

A computer typically includes hardware that may execute software and/orbe configured in hardware to perform specific functions. The softwaremay be stored on a computer-readable medium in the form ofcomputer-readable instructions. In some examples, the computer-readablemedium may be non-transitory. A computer may read the computer-readableinstructions, and in response perform various steps as defined by thosecomputer-readable instructions. Thus, any functions attributed to any ofthe functional components of FIG. 1 as described herein may beimplemented, for example, by reading and executing suchcomputer-readable instructions for performing those functions, and/or byany hardware subsystem (e.g., a processor) from which the computer iscomposed.

The term “computer-readable medium” as used herein includes not only asingle physical medium or single type of medium, but also a combinationof one or more physical media and/or types of media. Examples of acomputer-readable medium include, but are not limited to, one or morememories, hard drives, optical discs (such as CDs or DVDs), magneticdiscs, and magnetic tape drives.

Such a computer-readable medium may store computer-readable instructions(e.g., software) and/or computer-readable data (e.g., information thatmay or may not be executable). In the present example, acomputer-readable medium (such as a memory) may be included in any oneor more of the functional components shown in FIG. 1 and may storecomputer-executable instructions and/or data used by any of thosefunctional components. Alternatively or additionally, such acomputer-readable medium storing the data and/or software may bephysically separate from, yet accessible by, any of the functionalcomponents shown in FIG. 1.

An example functional component diagram of a computing device is shownin FIG. 2. The computing device in FIG. 2 may be sending computingdevice 102 coupled to network 106, may be receiving computing device 104coupled to network 106, or other computing device. In one aspect, thecomputing device may include at least one processor 201, at least onecommunications interface 202, at least one storage device 203, at leastone user interface 204, and at least one memory 205. In an example, thecomputer-readable medium may be embodied by storage device 203 and/ormemory 205, and processor 201 may execute computer-executableinstructions stored by storage device 203 and/or memory 205. Theprocessor 201 may also be one of many processors. Communicationsinterface 202 may provide for unidirectional or bidirectionalcommunications with any network or device external to that computingdevice, such as, for example, network 106. User interface 204 may allowfor unidirectional or bidirectional information transfer between thecomputing device and a human user, such as, for example, via a display,touchscreen, mouse, a keyboard, or other input/output device. Again, anyof the functional components of FIG. 1 may be implemented as a computingdevice such as shown in FIG. 2.

FIG. 3 illustrates a storage device in accordance with exampleembodiments of the disclosure. The storage device 203 may include arecording medium 302 (e.g., storage medium), a read/write head 304, anactuator arm 306, and an actuator 308. The storage device 203 may be,for example, a hard disk drive of a computing device. The recordingmedium 302 may be a platter which may be magnetically encoded with databy the read/write head 304. For simplicity, only a single recordingmedium 302 and only a single read/write head 304 are shown; however, thestorage device 203 may include two or more recording mediums and two ormore read/write heads. For example, the storage device 203 may includean array of stacked platters each having a read/write head 304. Othertypes of storage devices may also be used, such as those permittingwriting and/or playback of data.

In an example, the recording medium 302 may store data in circularlyshaped tracks. Two tracks 310A-B are shown on the recording medium 302using dashed lines, but the recording medium 302 may include more thantwo tracks. Each track 310 may be composed of one or more sectors thatare assigned unique identifiers. To read and/or write data to aparticular sector, the storage device 203 may use a unique identifier ofthe particular sector to determine a beginning location of the sector(e.g., track and starting position of the sector within the track). Thestorage device 203 may rotate the recording medium 302 and position theread/write head 304 at the beginning location of the sector to writeand/or read the stored data. For example, a first sector may begin atreference numeral 312 of track 310A and a second sector may begin atreference numeral 316 of track 310B. To prevent excessive and/orinefficient movement of the read/write head 304, the computing device102 and/or 104 may include a multi-buffer arrangement for efficientread/write operations to/from a storage device of file data processed byparallel threads, as described below.

FIG. 4 illustrates a multi-buffer arrangement in accordance with exampleembodiments of the disclosure. Depicted are buffer 401 and buffer 402.Each of computing device 102 and 104 may implement the buffers in memory205 (e.g., RAM, ROM, FLASH, etc.). Buffers 401 and 402 may store data ofa file read from and/or being written to the storage device 203.Although only two buffers are shown, more than two buffers may beimplemented. To read a file, the sending computing device 102 maydetermine a unique identifier indicating a beginning location of thefile stored on the recording medium 302. The recording medium 302 maysequentially store all of the data for the file starting at thatlocation so that the data is not fragmented when stored. By avoidingfragmenting the file, this permits the read/write head 304 to read datawhile moving in a single direction along the recording medium 302without requiring performance of unnecessary seek operations.

In an example where the file is written on a single track, the actuatorarm 306 may remain at a fixed position as the recording medium 302rotates during which the read/write head 304 reads all of the data forthe file. Thus, the storage device 203 may perform only a single seekoperation to position the read/write head 304 to read from a particulartrack and sector on the recording medium 302. In another example wherethe file data is written on multiple tracks, the actuator arm 306 mayremain at a fixed position as the recording medium 302 rotates duringwhich the read/write head 304 reads all of the data for the file on afirst track. The actuator arm 306 may adjust the location of theread/write head 304 to read data of the file from a second track, and soforth. Thus, the storage device 203 may only perform as many seekoperations as tracks on which the file is written. Sequentially storingdata in this manner avoids unnecessary delay caused by performingunnecessary seek operations.

With reference to FIG. 3, for example, a file may be written on track310A of the recording medium between reference numerals 312 and 314. Toread the file, the storage device 203 may rotate the recording mediumand position the read/write head 304 to read track 310A. As all data ofthe file is stored between reference numerals 312 and 314 along track310A, the read/write head 304 may be positioned only once on track 310Ato read data stored on the track between reference numerals 312 and 314as the recording medium 302 rotates without having to reposition theread/write head 304.

In conventional systems, reading a fragmented file, in contrast, wouldinvolve determining a beginning location of a first fragment of the fileon the recording medium 302, reading the fragment beginning at the firstlocation, identifying an end of the first fragment as well as abeginning location of a next fragment that is on a different trackand/or non-adjacent sector of a track, having the actuator arm 306reposition the read/write head 304 at the beginning location of the nextfragment, and so forth for subsequent fragments. In conventionalsystems, time is therefore lost due to repositioning of the read/writehead 304 on the recording medium 302 because the read/write head 304does not read the file data while being repositioned. For example, if afile were fragmented and a first fragment is recorded on track 310Abetween reference numerals 312 and 314 and a second fragment is recordedon track 310B between reference numerals 316 and 318, the actuator arm306 would have to reposition the read/write head 304 from track 310A to310B to read both fragments to obtain the entire file.

Referring again to an example embodiment and to FIG. 4, the sendingcomputing device 102 may receive an instruction to send a file to thereceiving computing device 104 via the network 106. The sendingcomputing device 102 may identify the file and its starting location(e.g., track and sector) on the recording medium 302, and may instructthe storage device 203 to move the read/write head 304 to begin readingof the file.

The read/write head 304 may read a predetermined amount of the file datafrom the recording medium 302 into buffer 401. For example, the sendingcomputing device 102 may read N blocks of the file data, wherein N maybe an integer. Each data block may be of a predetermined size (e.g., Dbytes, where D is number). For example, the storage device 203 mayinstruct the actuator arm 306 to position the read/write head 304 at aparticular location of the recording medium 302. The read/write head 304may read the file data beginning at the starting location and transferdata of the file byte by byte to buffer 401 in the same order the byteswere recorded on the recording medium 302.

Upon providing N×D (N multiplied by D) blocks of data to buffer 401(unless an end of file marker in the file is reached), the read/writehead 304 may continue reading the file data and transfer the next N×Dblocks of file data to buffer 402 (unless an end of file marker in thefile is reached) byte by byte to buffer 402 in the same order the byteswere recorded on the recording medium 302. Buffer 402 may store a sameamount of data as buffer 401 (i.e., N×D blocks of data). The sendingcomputing device 102 may wait to load further file data into either ofthe buffers until file data previously loaded has been processed by athread. The sending computing device 102 may load the file data from thestorage device 203 up to the end of file marker into one of the buffers.When at least one of the data blocks has been written into one of thebuffers 401 or 402, parallel threads may begin processing the data. Inan example, a thread may be a unit of computation inside a process. Thesending computing device 102 and/or the receiving computing device 104may include multiple processors where each processor implements onethread, and/or one processor may implement multiple threads.

FIG. 5 illustrates an example logical diagram of multiple threadsconcurrently processing blocks of file data stored in buffers inaccordance with example embodiments of the disclosure. Starting from theleft, the sending computing device 102 may load N×D blocks of file dataread from the storage device 203 into buffer 401, and then load the nextN×D blocks of file data from the storage device 203 into buffer 402.Each of threads 501-1 to 501-N may alternate reading and processingparticular blocks of the file data from each buffer. In an example,there may be as many threads as data blocks, or a greater or fewernumber of threads relative to data blocks. For example, thread 501-1 mayread and process file data stored by block 1 of buffer 401 and then readand process data stored by block 1 of buffer 402, thread 501-2 may readand process file data stored by block 2 of buffer 401 and then read andprocess data stored by block 2 of buffer 402, and so forth. Buffer 401is shown with solid lines and Buffer 402 is shown with dashed lines toindicate the alternative nature of reading and processing by thethreads. A block of file data in each buffer may correspond to a certainrange of bytes of the file each thread is assigned to process. Thread501-1 may be assigned to process bytes 0 to D of block 1 in each ofbuffers 401 and 402, thread 501-2 may be assigned to process bytes D+1to 2*D of block 2 in each of buffers 401 and 402, and so forth.

When a particular thread has finished processing a block of one buffer,that thread may inform the processor 201 to cause the processor 201 toinstruct the storage device 203 to load additional data of the file intothat block. For example, thread 501-1 may inform the processor 201 ofcompletion of processing block 1 of buffer 401, and the processor 201may instruct the storage device 203 to load the next file data intoblock 1 of buffer 401. The processor 201 may then schedule the thread tobegin processing of a data block in the same buffer if there is a blockthat has not yet been assigned to a thread, or in the other buffer. Forexample, the processor 201 may instruct thread 501-1 to begin processingblock 1 of buffer 402. In another example, threads 501-1 to 501-N may berandomly assigned to process any of the blocks in either buffer, basedon availability of a thread to process a block.

The processor 201 may delay scheduling a thread to begin processing of adata block in a buffer if unprocessed file data has yet to be loaded inthat block. For example, the processor 201 may wait to schedule thread501-1 to begin processing of block 1 in buffer 402 until the read/writehead 304 completes writing of new file data to block 1 of buffer 402.When the end of file marker is identified, the processor 201 may notschedule any further threads to process the buffers after the threadprocessing the data block in the buffer having the last of the filedata.

The processor 201 may thus schedule each thread to process correspondingblocks in buffers 401 and 402 until all of the file data has beenprocessed. The sending computing device 102 may thus alternate loadingof N×D blocks of data from a file into buffers 401 and 402 forprocessing by threads 501-1 to 501-N in parallel until an end of filemarker is detected indicating that the end of the file data has beenreached. The phrase “in parallel” may indicate that multiple threads maybe processing data blocks of a same buffer at the same time (or at leastsome of the threads may be processing data of a same buffer during aparticular time interval).

When processing a block of data, a thread may form the file data of aparticular block into packets and assign sequencing information to eachof the packets. The sequencing information may indicate a location ofthe file data within the file so that the file data can be organizedinto the proper sequence upon receipt. Each thread may cause the sendingcomputing device 102 to output the packets for transport to thereceiving computing device 104 via the network 106.

Prior to communicating with the receiving computing device 104 vianetwork 106, the sending computing device 102 may initiate a handshakewith the receiving computing device 104 and indicate a number of bytesof data of the file that are being sent. In an example, the sendingcomputing device 102 may asynchronously communicate the packets to thereceiving computing device 104. Upon receipt, the receiving computingdevice 104 may extract the file data blocks from the packets and mayprocess the file data blocks by multiple threads in parallel for writingto a storage device 203 using a multi-buffer arrangement, as furtherdescribed below.

FIG. 6 illustrates an example multi-buffer arrangement for parallelthread processing of data for writing to a storage device in accordancewith example embodiments of the disclosure. As file data is receivedfrom the network 106, processor 201 of the receiving computing device104 may schedule a set of threads 601 for processing the file data inparallel for writing the processed file data to a storage device 203.The receiving computing device 104 may queue the received file data and,as a thread becomes available, processor 201 may assign that thread toprocess a portion of the received file data. A thread may process thesequencing information in the packets to determine where in buffer 401or 402 to place the received file data in the correct order. Forexample, file data to be written to block 1 may be received after filedata to be written to block 3, but thread 601-1 may place the file datato be written to block 1 in block 1 of buffer 401 and thread 601-3 mayplace file data to be written to block 3 in block 3 of buffer 401,regardless of when blocks 1 and 3 were received.

In an example, the file data placed in buffer 401 or 402 may be placedin the proper sequential order so that the read/write head 304 maysequentially write the file data byte by byte to a track of therecording medium 302. Once the track is completely filled and if thereis more data to write, the read/write head 304 may be repositioned to adifferent track and may continue sequentially writing the file data.This process may continue until a last of the file data has beenwritten, and, at that time, the read/write head 304 may write an end offile marker at the end of the sequentially written file data. If thefile data is written on multiple tracks, the read/write head 304 mayalso write a pointer on the recording medium 302 identifying a beginninglocation of a next track where the sequentially written file datacontinues.

When a thread completes processing previously assigned file data,processor 201 may place the thread at an end of an assignment queue.When no other threads are before the thread in the queue, processor 201may assign subsequently received file data to that thread. The processor201 may assign threads to process the received file data until there isno more file data to assign. The processor 201 may determine that thereis no more data to be assigned based on sequencing information in thereceived packets indicating that a particular packet is last in thesequence, when all preceding packets in the sequence have also beenreceived. In another example, processor 201 may determine that there isno more data to be received when the number of bytes of data being sentspecified in the handshake has been received. In a further example,processor 201 may cause the receiving computing device 104 to send amessage to the sending computing device 102 requesting that a packet beresent should processor 201 determine that a packet is missing based onthe sequencing information.

The threads 601 may alternate between writing of received file data tobuffers 401 and 402. In an example, there may be a fewer or greaternumber of threads than blocks in buffer 401 or buffer 402. In anotherexample, the processor 201 may determine that buffer 401 corresponds toa first data range of N×D blocks and buffer 402 corresponds to a seconddata range of N×D blocks. The threads 601 may write to the buffers 401and 402 based on the sequencing information such that the file datastored in the buffers 401 and 402 is in the correct sequential order.The threads 601 may process the sequencing information to order thereceived file data in the correct order when writing to buffers 401 and402.

The processor 201 may track which blocks of each buffer have been filledwith file data. For example, processor 201 may determine that threadshave been assigned to write to blocks 1 through N−1 of buffer 401. Whena packet or packets carrying the file data for block N is received,processor 201 may assign a next available thread to write to block N ofbuffer 401.

The processor 201 may then assign threads that subsequently becomeavailable to begin writing to the blocks of buffer 402. Once threadshave been assigned to write to a last of the blocks in buffer 402,assuming there is more data to be received and the data from buffer 401has been written to the storage device 203, processor 201 may then beginassigning threads to write to the blocks of buffer 401. In this manner,processor 201 may assign the threads such that they alternate back andforth between writing to buffer 401 and buffer 402.

Prior to writing to a particular block in buffer 401 or 402, processor201 may confirm that buffer 401 or 402 is ready to receive data at thatblock (e.g., data was previously written to the recording medium and/orcan be overwritten). If so, processor 201 may schedule a thread to writeto that block. If not, processor 201 may delay the scheduling until thatblock is ready to receive data. For example, when thread 601-1 hasfinished writing to block 1 of buffer 401, thread 601-1 may request towrite data in block 1 of buffer 402. The processor 201 may delay orinstruct thread 601-1 to write to block 1 of buffer 402 based on whetherblock 1 of buffer 402 is ready to receive data.

Once a thread has written to its block in either buffer, that thread mayinform processor 201 that a particular block is ready for transfer tostorage device 203. For example, thread 601-1 may inform processor 201that D bytes of file data have been transferred to block 1 of buffer401.

Once threads 601-1 to 601-N have written to all of the blocks for one ofthe buffers (i.e., N×D blocks of file data), processor 201 may transferthe blocks of buffered file data in sequential order to the storagedevice 203 beginning at a first byte of block 1 of the buffer andcontinuing through a last byte of block N of the buffer. For example,thread 601-1 may write D bytes of file data to block 1 of buffer 401,thread 601-2 may write D bytes of file data to block 2 of buffer 401,and so forth until each thread has filled its corresponding block ofbuffer 401 (or until there is no more data to write to buffer 401). Theprocessor 201 may transfer block 1, followed by block 2, and so forth ofbuffer 401 to the storage device 203 for writing blocks 1-N on therecording medium 302 in the same order as blocks 1-N are stored inbuffer 401. Thus, the storage device 203 may write the data blocks tothe recording medium 302 in the same order the data blocks were storedin each buffer.

In an example, processor 201 may transfer blocks of data from one of thebuffers 401 and 402 to the storage device 203 in sequential order aseach block is completely filled or may wait until a buffer 401 or 402 iscompleted filled. For example, processor 201 may transfer block 1 ofbuffer 401 to the storage device 203 as soon as block 1 is filled,followed by transferring block 2 of buffer 401 to the storage device 203after block 1 is transferred and as soon as block 2 is filled, and soforth until block N is filled and transferred. The processor 201 maythen proceed to transfer block 1 of buffer 402 to the storage device 203as soon as block 1 is filled, followed by transferring block 2 of buffer402 to the storage device 203 after block 1 is transferred and as soonas block 2 is filled, and so forth until block N of buffer 402 is filledand transferred. The processor 201 may alternate between transferring ofthe data blocks from each buffer until reaching the end of the filedata.

When writing data blocks to the recording medium 302, the storage device203 may attempt to place all of the file data on a single track. Forexample, processor 201 may determine a size of the file to be written,and may query the storage device 203 to identify any track on therecording medium 302 having sufficient space to store the entire file.If the file is too large to be written on any single track, processor201 may query the storage device to identify if there are two adjacenttracks with sufficient space to store the file. This process maycontinue until a minimum number of adjacent tracks have been identifiedto store the entire file.

Once a location on the recording medium 302 has been identified, thestorage device 203 may move the read/write head 304 to that location andbegin sequentially writing N×D byte amounts of the file data from buffer401 or 402 in a single direction along the track of the recording medium302. For example, with reference to FIG. 3, the read/write head 304 maydetermine to write the file data beginning at reference numeral 312 ontrack 310A and continuing writing along the arc of track 310A towardreference numeral 314 as the recording medium rotates in a counterclockwise direction (see reference numeral 320).

When the read/write head 304 finishes writing a particular N×D byteamount of file data from one of the buffers, the read/write head 304 maybegin writing a next N×D byte amount of file data from the other of thebuffers adjacent to the previous N×D byte amount in the same directionuntil all of the file data has been written. For example, the read/writehead 304 may sequentially write all of the data blocks from buffer 401and then begin sequentially writing all of the data blocks from buffer402. Block N of buffer 401 may be written adjacent to block 1 of buffer402 on the recording medium 302. When there is no more data, theread/write head 304 may include an end of file marker on the recordingmedium 302 to denote the end of the file (e.g., at reference numeral314). If the file data is stored on multiple tracks, the read/write head304 may also insert a pointer at the end of the file data on one trackpointing to a beginning location of the data on another track.

The read/write head 304 may thus sequentially write all of the datablocks for a file adjacent to one another in a single direction on asame track, thereby not requiring the read/write head 304 tounnecessarily move to a non-adjacent sector on the same track. If all ofthe file data is written on a single track, the read/write head 304 mayonly have to perform a single seek operation as all of the file data isstored in an unfragmented manner on the recording medium 302. In anotherexample, the storage device 203 may minimize the number of differenttracks on which the file data is stored, and may store the file data oneach track in an unfragmented manner. This example may only involve asingle seek operation per track on which the file data is written.

Further, the read/write head 304 may write on the recording medium 302moving in a single direction without having to interrupt writing to moveto a different location on a same track within the recording medium 302.When the entire file data is written on a single track, the exampleembodiments might not require maintaining information about thedifferent starting and ending locations of multiple file fragments onthe same track. When written on multiple tracks, the example embodimentsmay only require a single seek operation per track on which the filedata is written. The example embodiments therefore provide improvedreading and writing to a recording medium of data concurrently processedby threads while eliminating or reducing unnecessary movement of theread/write head caused by file fragmentation.

FIG. 7 illustrates a flow diagram of an example method for reading filedata in accordance with example embodiments of the disclosure. FIG. 7may be implemented by a computer, such as, for example, the sendingcomputing device 102, or other apparatus. The order of the steps shownin FIG. 7 may also be rearranged, additional steps may be included, somesteps may be removed, and some steps may be repeated one or more times.The method may begin at 702.

In 702, the method may include sequentially reading, by a computingdevice, data of a file stored on a storage medium. For example,processor 201 of a computing device 102 may instruct a read/write head304 of storage device 203 to identify a beginning location on a track310 of where a file is located on a recording medium 302 and to beginsequentially reading the file data along the track 310.

In 704, the method may include alternating transferring of fixed sizeportions of the file data to a first buffer and a second buffer. Forexample, storage device 203 may transfer a first N×D blocks of the fileto buffer 401, a next N×D blocks of the file to buffer 402, alternatingof the transferring of subsequent N×D blocks of the file back and forthto buffers 401 and 402 until reaching an end of the file.

In 706, the method may include alternating processing of data blocks ofthe fixed sized portions in parallel from the first and second buffersby a plurality of processing threads. For example, in parallel, thread501-1 may process block 1 of buffer 401, thread 501-2 may process block2 of buffer 401, and so forth through thread 501-N may process block Nof buffer 401. After completing of processing the file data stored inbuffer 401, threads 501-1 to 501-N may respectively process blocks 1-Nof buffer 402 in parallel. The threads 501-1 to 501-N may alternateprocessing blocks from buffers 401 and 402 until all data of the filehas been processed. The sending computing device 102 may also randomlyassign each of the threads to process any unprocessed data blocks withineither buffer. Also, there may be a fewer or greater number of threadsrelative to the number of blocks in buffer 401 or buffer 402.

In 708, the method may include outputting the processed data blocks. Forexample, the sending computing device 102 may transmit packetscontaining all or portions of data blocks to a network interface fortransfer to a receiving computing device 104 via network 106. Thethreads may include the file data and sequencing information in packetsto permit ordering of the processed file data upon receipt into the sameorder in which the packets were sent. The method may then end or mayreturn to any of the preceding steps.

FIG. 8 illustrates a flow diagram of an example method for writing filedata to a storage device in accordance with example embodiments of thedisclosure. FIG. 8 may be implemented by a computer, such as, forexample, the receiving computing device 104 or other apparatus. Theorder of the steps shown in FIG. 8 may also be rearranged, additionalsteps may be included, some steps may be removed, and some steps may berepeated one or more times. The method may begin at 802.

In 802, the method may include receiving data of a file. For example,the receiving computing device 104 may receive packets sent by sendingcomputing device 102 via network 106 a network interface, where thepackets contain data of a file and sequencing information.

In 804, the method may include assigning portions of the data to each ofa plurality of processing threads for processing of the assignedportions by the respective threads in parallel, each of the threadsbeing implemented by at least one processor.

In 806, the method may include writing, by the threads in parallel,blocks of the data to a first buffer and blocks of the data to a secondbuffer. For example and with reference to FIG. 6, threads 601-1 to 601-Nmay respectively write assigned portions of the received data to datablocks in buffer 401 and to data blocks in buffer 402.

In 808, the method may include alternating transferring of the datablocks in the first buffer and the data blocks in the second buffer to astorage device. For example, the receiving computing device 104 maytransfer the data contained in blocks 1-N of buffer 401 to the storagedevice 203, followed by the data contained in blocks 1-N of buffer 402to the storage device 203.

In 810, the method may include sequentially writing, by the storagedevice, each of the data blocks from the first buffer adjacent to oneanother on a storage medium. For example, the read/write head 304 of thestorage device 203 may write block 1 of buffer 401 to the recordingmedium 302, followed by block 2 of buffer 401 after finishing writing ofblock 1, and so forth until having written block N of buffer 401. Onceall of the blocks of data from buffer 401 have been written, theread/write head 304 may then write block 1 of buffer 402 on therecording medium 302 adjacent to block N of buffer 401, block 2 ofbuffer 402 adjacent to block 1 of buffer 402, and so forth. Theread/write head 304 may alternate writing data blocks from buffers 401and 402 until all of the data of a file has been written. The read/writehead 304 may then record an end of file marker on the recording medium302 at the end of the file. The method may then end or may return to anyof the preceding steps.

Therefore, the example embodiments may be used in any application thatreads or writes data on storage devices using parallel threads. Further,by including an end of file marker at the end of the file data beingwritten to the recording medium, the example embodiments eliminate theissue of having to write after receipt of the end of file marker, incontrast with conventional systems.

Any of the above-mentioned functional components may be implemented withat least one processor and at least one memory. The functionalcomponents may include hardware that may execute software and/or beconfigured in hardware to perform specific functions. The software maybe stored on a computer-readable medium in the form of computer-readableinstructions. A computer may read those computer-readable instructions,and in response perform various steps as defined by thosecomputer-readable instructions. Thus, any functions attributed to any ofthe components of FIG. 1 as described herein may be implemented, forexample, by reading and executing such computer-readable instructionsfor performing those functions, and/or by any hardware subsystem (e.g.,a processor) from which the computer is composed.

While embodiments have been described with respect to specific examplesincluding presently preferred modes of carrying out the invention, thoseskilled in the art will appreciate that there are numerous variationsand permutations of the above described systems and techniques. Thus,the spirit and scope of the invention should be construed broadly as setforth in the appended claims.

The invention claimed is:
 1. A method comprising: assigning, by acomputing device, portions of received data to parallel threads; andalternating writing a first block of the received data in a sequentialorder to a first buffer and a second block of the received data in thesequential order to a second buffer.
 2. The method of claim 1, furthercomprising: writing from the first buffer and from the second buffer toa first track of a storage medium the received data in the sequentialorder until the first track is filled.
 3. The method of claim 2, furthercomprising: during the writing from the first buffer and from the secondbuffer to the first track of the storage medium the received data,maintaining a fixed position of a write/read head of the storage medium;and in response to a determination that the first track is filled,writing from the first buffer and from the second buffer to a secondtrack of the storage medium at least one block of the received data inthe sequential order until at least one of: a last block of the receiveddata is written to the second track, and the second track is filled,wherein the second track of the storage medium is adjacent to the firsttrack of the storage medium.
 4. The method of claim 2, wherein thewriting from the first buffer and from the second buffer to the firsttrack of the storage medium the received data in the sequential orderfurther comprises writing each block of the received data adjacent toone another on the first track.
 5. The method of claim 2, wherein thewriting from the first buffer and from the second buffer to the firsttrack of the storage medium the received data in the sequential orderfurther comprises writing to the first track an initial block from thesecond buffer adjacent to a last block from the first buffer.
 6. Themethod of claim 2, further comprising: initiating the writing from thefirst buffer and from the second buffer to the first track of thestorage medium the received data in the sequential order when at leastone of the first buffer and the second buffer is filled.
 7. The methodof claim 1, further comprising receiving the received data in anon-sequential order.
 8. The method of claim 1, wherein each block ofthe received data has a size equal to another block of the receiveddata.
 9. A method comprising: determining, by a computing device, aminimum number of adjacent tracks of a storage medium to store receiveddata; and alternating writing a first block of the received data in asequential order to a first buffer and a second block of the receiveddata in the sequential order to a second buffer.
 10. The method of claim9, further comprising: writing from the first buffer and from the secondbuffer to a first track of the adjacent tracks the received data in thesequential order until the first track is filled.
 11. The method ofclaim 10, further comprising: while the received data is written fromthe first buffer and from the second buffer to the first track,maintaining a fixed position of a write/read head of the storage medium;and writing from the first buffer and from the second buffer to a secondtrack of the adjacent tracks at least one block of the received data inthe sequential order until at least one of: a last block of the receiveddata is written to the second track, and the second track is filled,wherein the second track is adjacent to the first track of the storagemedium.
 12. The method of claim 10, wherein the writing from the firstbuffer and from the second buffer to the first track of the adjacenttracks the received data in the sequential order further compriseswriting each block of the received data adjacent to one another on thefirst track.
 13. The method of claim 10, wherein the writing from thefirst buffer and from the second buffer to the first track of theadjacent tracks the received data in the sequential order furthercomprises writing to the first track an initial block from the secondbuffer adjacent to a last block from the first buffer.
 14. The method ofclaim 10, further comprising: initiating the writing from the firstbuffer and from the second buffer to the first track of the adjacenttracks the received data in the sequential order when at least one ofthe first buffer and the second buffer is filled.
 15. The method ofclaim 9, further comprising receiving the received data in anon-sequential order.
 16. The method of claim 9, wherein each block ofthe received data has a size equal to another block of the receiveddata.
 17. A method comprising: writing, by a computing device, from afirst buffer and from a second buffer a plurality of data blocks to afirst track of a storage medium in a sequential order until the firsttrack is filled.
 18. The method of claim 17, further comprising:assigning the plurality of data blocks to parallel threads; andalternating writing a first data block of the plurality of data blocksin the sequential order to the first buffer and a second data block ofthe plurality of data blocks in the sequential order to the secondbuffer.
 19. The method of claim 18, further comprising: assigning aparticular thread of the parallel threads to write a first particulardata block to the first buffer; and reassigning the particular thread towrite a second particular data block to the first buffer after the firstparticular data block has been written to the first buffer.
 20. Themethod of claim 17, further comprising: determining whether the firsttrack of the storage medium has sufficient space available to store theplurality of data blocks.